<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>简单计算器</title>
</head>
<body>
<div id="app">
  <div style="width: 400px; border: 1px solid grey">
    <h2>简单计算器</h2>
    数值A：<input type="text" v-model="a1" /> <br>
    数值B：<input type="text" v-model="a2" /> <br>
    <button @click="add">计算</button>
    <br>
    计算结果：{{sum}}
  </div>
</div>

<script src="../lib/vue.js"></script>
<script>
  let vm = new Vue({
    el: '#app',
    data: {
      sum: 0,
      a1: '',
      a2: ''
    },
    methods: {
      add() {
        this.sum = parseInt(this.a1) + parseInt(this.a2);
      }
    }
  })
</script>

</body>
</html>